package com.xbongbong.saas.enums.business;

import lombok.Getter;

/**
 * 关联回款选择类型
 * @author yuqian
 * @version v1.0
 * @date 2019/11/4 17:21
 * @since v1.0
 */
@Getter
public enum PayRelationshipEnum {
    //关联付款选择类型
    PAY_PLAN("1","pay_plan","enum.payRelationship.name.pay_plan"),
    PAY_SHEET("2","pay_sheet","enum.payRelationship.name.pay_sheet"),
    UNKNOWN("404","","enum.payRelationship.name.unknown");

    private String code;
    private String name;
    private String alias;

    PayRelationshipEnum(String code,String name,String alias){
        this.code = code;
        this.name = name;
        this.alias = alias;
    }

    public static PayRelationshipEnum getByCode(String code){
        for(PayRelationshipEnum cacheCode : values()){
            if(code.equals(cacheCode.getCode())){
                return cacheCode;
            }
        }
        return UNKNOWN;
    }
}